package ru.ifmo.kis.domaingen;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;

// Nov 24, 2010 4:04:23 PM
@javax.persistence.Table(name = "users", catalog = "ItmoKis")
@Entity
public class UsersEntity {
	private int id;

	@javax.persistence.Column(name = "id", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
	@Id
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	private int role;

	@javax.persistence.Column(name = "role", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
	@Basic
	public int getRole() {
		return role;
	}

	public void setRole(int role) {
		this.role = role;
	}

	private String firstname;

	@javax.persistence.Column(name = "firstname", nullable = true, insertable = true, updatable = true, length = 64, precision = 0)
	@Basic
	public String getFirstname() {
		return firstname;
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	private String lastname;

	@javax.persistence.Column(name = "lastname", nullable = true, insertable = true, updatable = true, length = 64, precision = 0)
	@Basic
	public String getLastname() {
		return lastname;
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

	private String email;

	@javax.persistence.Column(name = "email", nullable = true, insertable = true, updatable = true, length = 200, precision = 0)
	@Basic
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	private String password;

	@javax.persistence.Column(name = "password", nullable = true, insertable = true, updatable = true, length = 64, precision = 0)
	@Basic
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		UsersEntity that = (UsersEntity) o;

		if (id != that.id) return false;
		if (role != that.role) return false;
		if (email != null ? !email.equals(that.email) : that.email != null) return false;
		if (firstname != null ? !firstname.equals(that.firstname) : that.firstname != null) return false;
		if (lastname != null ? !lastname.equals(that.lastname) : that.lastname != null) return false;
		if (password != null ? !password.equals(that.password) : that.password != null) return false;

		return true;
	}

	@Override
	public int hashCode() {
		int result = id;
		result = 31 * result + role;
		result = 31 * result + (firstname != null ? firstname.hashCode() : 0);
		result = 31 * result + (lastname != null ? lastname.hashCode() : 0);
		result = 31 * result + (email != null ? email.hashCode() : 0);
		result = 31 * result + (password != null ? password.hashCode() : 0);
		return result;
	}
}
